from rest_framework import serializers
from .models import UserModel


# 反序列化添加用户
class UserUnSerializer(serializers.Serializer):
    username = serializers.CharField(max_length=32)
    password = serializers.CharField(max_length=255)

    def create(self, validated_data):
        return UserModel.objects.create(**validated_data)
